<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>计算器</title>
		<script>
			function calc(){
				let num1=parseInt(document.getElementById('num1').value);
				let num2=parseInt(document.getElementById('num2').value);
				let sysbol=document.getElementById('sysbol').value;
				let  result=0;
				switch(sysbol){
					case  "+":
					result=num1+num2;
					break;
					case  "-":
					result=num1-num2;
					break;
					case  "*":
					result=num1*num2;
					break;
					case  "/":
					if(num2!=0){
						result=num1/num2;
					}else{
						alert("0不能做除数哦")
					}
					break;
					default:
					alert("运算符错误")
				}
				document.getElementById("result").value=result;
				}
		</script>
	</head>
	<body>
		<input   id="num1"  type="number" />
		<input id="sysbol"  type="text" />
		<input id="num2"  type="number" />
		<button onclick="calc() ">等于</button>
		<input id="result" type="number" readonly />
	</body>
</html>
